package com.dt76.smallloanbackendservice.controller.lhuaw;


import com.dt76.smallloanbackendservice.pojo.lhuaw.Application;
import com.dt76.smallloanbackendservice.service.lhuaw.ApplicationService;
import com.dt76.smallloanbackendservice.utils.Page;
import com.dt76.smallloanbackendservice.utils.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@Controller
@RequestMapping("/lhuaw")
public class ApplicationController {
    @Resource
    private ApplicationService applicationService;

    @RequestMapping("/qryAllApplication")
    @ResponseBody
    public List<Application> qryAllApplication(){
        return applicationService.qryAllApplication();
    }

    @RequestMapping("/getApplicationAll")
    @ResponseBody
    public Page getApplicationAll(@RequestParam("pageIndex")  int pageIndex){
        System.out.println("成功调用远程");
        return applicationService.getApplicationAll(pageIndex);
    }
//删除
    @RequestMapping("/deleteStation")
    @ResponseBody
    public Result deleteStation(@RequestParam("numId")int numId){
        System.out.println("成功调用删除方法，ApplicationService.deleteStation>>>>>>>>");
        try {
            applicationService.deleteStation(numId);
            return new Result(true,"删除成功>>>");
        } catch (Exception e) {
            return new Result(false,"删除失败>>>");
        }
    }
}
